Skip to content

fix: eliminate TOCTOU race in file unlink calls - #3815

Merged
mnriem merged 1 commit into
github:mainfrom
Quratulain-bilal:fix/except-pass-silent-errors
Jul 29, 2026
Merged

fix: eliminate TOCTOU race in file unlink calls#3815
mnriem merged 1 commit into
github:mainfrom
Quratulain-bilal:fix/except-pass-silent-errors

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Replace if path.exists(): path.unlink() with path.unlink(missing_ok=True) in integrations/_helpers.py and extensions/init.py clear_cache to eliminate TOCTOU race conditions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Eliminates TOCTOU races when deleting integration and extension cache files.

Changes:

  • Replaces existence checks followed by unlink() with atomic unlink(missing_ok=True).
  • Preserves behavior when target files are absent.
Show a summary per file
File Description
src/specify_cli/integrations/_helpers.py Safely removes legacy integration metadata.
src/specify_cli/extensions/__init__.py Safely clears extension catalog cache files.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

@mnriem
mnriem merged commit e543147 into github:main Jul 29, 2026
14 checks passed
@mnriem

mnriem commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants